<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:o="http://openfaces.org/"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <head>
    </head>
    <body>
        <ui:composition template="/templates/default.xhtml">
		 	<ui:define name="title">OpenHDS - Create Death</ui:define>
		
			<ui:param name="crud" value="#{deathCrud}" />
			
            <ui:define name="listing">
                <ui:include src="list.xhtml" />
            </ui:define>
            <ui:define name="display">
            
            	<h:outputText value="#{navController.breadcrumbTrail}" />
            
                <h1><h:outputText value="#{msg.deathCreate}" /></h1>
                <h:messages id="errors" globalOnly="true" />
                <h:form id="form">
                    <h:panelGrid columns="3">

		            	<h:outputText value="#{msg.individualId}:"/>
		                <h:inputText styleClass="individual" id="indiv" value="#{deathCrud.item.individual}" disabled="#{flowScope != null}" converter="#{individualExtIdConverter}" autocomplete="off"/>
		            	<h:message for="indiv" errorClass="error" errorStyle="color: red" infoStyle="color: green"/>

                        <h:outputText value="#{msg.deathPlace}:"/>
                        <h:inputText id="deathPlace" value="#{deathCrud.item.deathPlace}" converter="#{defaultConverter}"/>
                        <h:message for="deathPlace" errorClass="error" errorStyle="color: red" infoStyle="color: green"/>

                        <h:outputText value="#{msg.deathCause}:"/>
                        <h:inputText id="deathCause" value="#{deathCrud.item.deathCause}" converter="#{defaultConverter}"/>
                        <h:message for="deathCause" errorClass="error" errorStyle="color: red" infoStyle="color: green"/>

                        <h:outputText value="#{msg.deathDate} (#{siteProperties.dateFormat})" />
                        <o:dateChooser id="deathDate" value="#{deathCrud.deathDate}" pattern="#{siteProperties.dateFormat}" />
                        <h:message for="deathDate" errorClass="error" errorStyle="color: red" infoStyle="color: green"/>

						<h:outputText value="#{msg.fieldWorkerId}:"/>
                        <h:inputText styleClass="collectedBy" autocomplete="off" id="fieldWorker" value="#{deathCrud.item.collectedBy}" converter="#{fieldWorkerExtIdConverter}"/>
                        <h:message for="fieldWorker" errorClass="error" errorStyle="color: red" infoStyle="color: green"/>
	                   	
	                   	<h:outputText value="#{msg.visitId}:"/>
	                   	<h:inputText styleClass="visit" autocomlete="off" id="visit" value="#{deathCrud.item.visitDeath}" converter="#{visitExtIdConverter}" disabled="#{flowScope != null}"/>
	            		<h:message for="visit" errorClass="error" errorStyle="color: red" infoStyle="color: green"/>
                    </h:panelGrid>
                    <script>
                   		document.getElementById('form:deathPlace').focus();
  						document.getElementById('form:indiv').focus();
  					</script>

                    <br />
                    <h:commandButton action="#{deathCrud.create}" value="#{msg.lblCreate}"/>
                	<h:commandButton value="Cancel" immediate="true" action="cancel" rendered="#{flowScope != null}"/>
                </h:form>
            </ui:define>
        </ui:composition>
    </body>
</html>
